<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml"
      xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      layout:decorator="/web/_layouts/default">
<head>
    <title>Title</title>
</head>
<body>
<div layout:fragment="content">
    <!--评论框测试-->
    <h3>顶级评论</h3>
    <form th:action="@{/api/v1/reply/add}" method="post">
        OID: <input type="text" name="oid" value="5a2672f0205f04b3392ab89b"> <br>
        type: <input type="text" name="type" value="1"> <br>
        root: <input type="text" name="root" value=""> <br>
        parent: <input type="text" name="parent" value=""> <br>
        message: <input type="text" name="message" value="评论内容"> <br>
        <input type="submit" value="提交">
    </form>

    <div class="container">
        <div class="comment-holder"
             data-oid="5a2672f0205f04b3392ab89b"
             data-type="1"
             data-avatar="/public/images/default_avatar.gif"
        ></div>
    </div>

    <script>
        $(function () {
            $('form').ajaxForm({
                dataType: 'json',
                beforeSubmit: function (arr, form, option) {
                    form.find("button:submit").attr('disable', true);
                },
                success: function (data, statusText, xhr, form) {
                    if (data.code === 200) {
                        form.resetForm(); // 重置表单
                        layer.msg(data.message, {icon: 1});
                    } else {
                        layer.msg(data.message, {icon: 2});
                    }
                    form.find("button:submit").attr('disable', false);
                }
            });
            var comment = new Comment('.comment-holder');

        });
    </script>
</div>
</body>
</html>